﻿namespace UnityEngine
{
    using System;
    using System.Runtime.CompilerServices;
    using UnityEngineInternal;

    public class Component : UnityEngine.Object
    {
        public void BroadcastMessage(string methodName)
        {
            SendMessageOptions requireReceiver = SendMessageOptions.RequireReceiver;
            object parameter = null;
            this.BroadcastMessage(methodName, parameter, requireReceiver);
        }

        public void BroadcastMessage(string methodName, object parameter)
        {
            SendMessageOptions requireReceiver = SendMessageOptions.RequireReceiver;
            this.BroadcastMessage(methodName, parameter, requireReceiver);
        }

        public void BroadcastMessage(string methodName, SendMessageOptions options)
        {
            this.BroadcastMessage(methodName, null, options);
        }

        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void BroadcastMessage(string methodName, object parameter, SendMessageOptions options);
        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern bool CompareTag(string tag);
        public T GetComponent<T>() where T: Component
        {
            return (this.GetComponent(typeof(T)) as T);
        }

        public Component GetComponent(string type)
        {
            return this.gameObject.GetComponent(type);
        }

        [MethodImpl(MethodImplOptions.InternalCall), TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument), WrapperlessIcall]
        public extern Component GetComponent(System.Type type);
        public T GetComponentInChildren<T>() where T: Component
        {
            return (T) this.GetComponentInChildren(typeof(T));
        }

        [TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
        public Component GetComponentInChildren(System.Type t)
        {
            return this.gameObject.GetComponentInChildren(t);
        }

        public T[] GetComponents<T>() where T: Component
        {
            return (T[]) this.GetComponentsWithCorrectReturnType(typeof(T));
        }

        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern Component[] GetComponents(System.Type type);
        public T[] GetComponentsInChildren<T>() where T: Component
        {
            return this.GetComponentsInChildren<T>(false);
        }

        public T[] GetComponentsInChildren<T>(bool includeInactive) where T: Component
        {
            return this.gameObject.GetComponentsInChildren<T>(includeInactive);
        }

        public Component[] GetComponentsInChildren(System.Type t)
        {
            bool includeInactive = false;
            return this.GetComponentsInChildren(t, includeInactive);
        }

        public Component[] GetComponentsInChildren(System.Type t, bool includeInactive)
        {
            return this.gameObject.GetComponentsInChildren(t, includeInactive);
        }

        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        private extern Component[] GetComponentsWithCorrectReturnType(System.Type type);
        public void SendMessage(string methodName)
        {
            SendMessageOptions requireReceiver = SendMessageOptions.RequireReceiver;
            object obj2 = null;
            this.SendMessage(methodName, obj2, requireReceiver);
        }

        public void SendMessage(string methodName, object value)
        {
            SendMessageOptions requireReceiver = SendMessageOptions.RequireReceiver;
            this.SendMessage(methodName, value, requireReceiver);
        }

        public void SendMessage(string methodName, SendMessageOptions options)
        {
            this.SendMessage(methodName, null, options);
        }

        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void SendMessage(string methodName, object value, SendMessageOptions options);
        public void SendMessageUpwards(string methodName)
        {
            SendMessageOptions requireReceiver = SendMessageOptions.RequireReceiver;
            object obj2 = null;
            this.SendMessageUpwards(methodName, obj2, requireReceiver);
        }

        public void SendMessageUpwards(string methodName, object value)
        {
            SendMessageOptions requireReceiver = SendMessageOptions.RequireReceiver;
            this.SendMessageUpwards(methodName, value, requireReceiver);
        }

        public void SendMessageUpwards(string methodName, SendMessageOptions options)
        {
            this.SendMessageUpwards(methodName, null, options);
        }

        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]
        public extern void SendMessageUpwards(string methodName, object value, SendMessageOptions options);

        [Obsolete("the active property is deprecated on components. Please use gameObject.active instead. If you meant to enable / disable a single component use enabled instead.")]
        public bool active { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] set; }

        public Animation animation { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public AudioSource audio { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public Camera camera { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public Collider collider { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public ConstantForce constantForce { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public GameObject gameObject { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        [Obsolete("Please use guiTexture instead")]
        public GUIElement guiElement { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public GUIText guiText { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public GUITexture guiTexture { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public HingeJoint hingeJoint { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public Light light { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public NetworkView networkView { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public ParticleEmitter particleEmitter { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public ParticleSystem particleSystem { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public UnityEngine.Renderer renderer { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public Rigidbody rigidbody { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }

        public string tag { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] set; }

        public Transform transform { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; }
    }
}

